package shop.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import shop.dao.IAddressDao;
import shop.dao.IUsersDao;

@Service
public class AddressServiceImpl implements IAddressService {
	
	@Resource
	private IAddressDao addressDao;
	
	@Resource
	private IUsersDao usersDao;

	@Override
	public int del(int id) {
		//判断是否是默认收货地址
		int addressId = usersDao.getDefaultAddress(1);//1是模拟登录用户的id
		if(addressId==id) {//如果删除是默认收货地址
			return 0;
		}else {
			return addressDao.del(id);
		}
	}

}
